﻿using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using MTL_Math;
using System.Xml;

namespace TX_TOOLBOX
{
    ///ChenTaiBlockPM
    ///
    /// <summary>
    /// 群桩的描述,定义点是承台中心
    /// </summary>
    internal class ColumnFlowerSteelBlockCM2 : BaseBlock
    {


        internal ColumnFlowerSteelBlockCM2()
        {

        }


        public ColumnFlowerBlockLM2 blockCM = null;

        public double BHC = 40;
        public double ColumnDrawH { get { return blockCM.dzH - blockCM.zzH; } }
        public double topInforceH = 1500;
        public double dwnInforceH = 1500;
        public double topInforceDist = 100;
        public double dwnInforceDist = 100;
        public double ColumnDist = 200;
        public double dwnInsertShort = 1500;
        public double dwnInsertLong = 1800;
        public double dwnInsertHook = 1000;
        public double dwnInsertDist = 200;
        public double ColumnNormalH { get { return ColumnDrawH - topInforceH - dwnInforceH; } }

        public double blockCM_dzY { get { return blockCM.ColumnWO; } }
        public double blockCM_dzY1 { get { return blockCM.ColumnWTopO; } }
        public double blockCM_dzH { get { return blockCM.dzH; } }
        public double blockCM_dzH1 { get { return blockCM.dzHtw; } }

        //public double blockCM_dzY { get { return blockCM.dzY; } }
        //public double blockCM_dzY1 { get { return blockCM.dzY1; } }
        //public double blockCM_dzH { get { return blockCM.dzH; } }
        //public double blockCM_dzH1 { get { return blockCM.dzH1; } }

        public SteelDrawBase ist_top_dot = new SteelDrawBase("1", 16, "");
        public SteelDrawBase ist_top_lin = new SteelDrawBase("2", 16, "");
        public SteelDrawBase ist_top_dot2 = new SteelDrawBase("9", 16, "");
        public SteelDrawBase ist_top_lin2 = new SteelDrawBase("9", 16, "");
        public SteelDrawBase ist_hook_change = new SteelDrawBase("3", 16, "");
        public SteelDrawBase ist_hook_same = new SteelDrawBase("4", 16, "");
        public SteelDrawBase ist_vert_side = new SteelDrawBase("8", 16, "");
        public SteelDrawBase ist_vert_long = new SteelDrawBase("7", 16, "");
        public SteelDrawBase ist_vert_short = new SteelDrawBase("8", 16, "");
        public SteelDrawBase ist_dot_inner_change = new SteelDrawBase("9", 16, "");
        public SteelDrawBase ist_dot_inner_same = new SteelDrawBase("9", 16, "");

        #region Clone
        public object Clone()
        {
            ColumnRSteelBlockLM newObj = (ColumnRSteelBlockLM)this.MemberwiseClone();
            return newObj;
        }
        #endregion

        public override void Draw(DatabaseToAcad block)
        {


            // 类型1：圆、方柱子 + 扩大头 有支座（适用于连续梁）
            // ------------------------------------
            //立柱
            //          startPoint = 在墩顶，在支座下面
            //
            //   2         0       3 
            //    |----|       |----|    dzH1
            //    |    |1  1  2|    |
            //    |    |-------|    |
            //    |    |-------|    |
            //    |    |       |    |
            //    |    |3     4|    |
            //   4\    \       /    /5
            //     \    \     /    /     dzH2
            //      \    \   /    /
            //     6|   5|   |6  |7
            //      |    |   |   |      dzH
            //      |    |   |   |
            //     8|   7|   |8  |9    dzW
            //          内侧线
            //
            // ------------------------------------


            if (blockCM == null)
                return;

            DatabaseToAcad blockSub = new DatabaseToAcad(block.style.BlockScale);
            blockCM.IsDrawGeneral = true;
            blockCM.isHaveTopXL = false; //侧面钢筋图不画系梁
            blockCM.IsDrawZZ = false;

            String temp_gz1Layer = CommonLayer.gz1layer;
            String temp_gz2Layer = CommonLayer.gz2layer;
            String temp_gz3Layer = CommonLayer.gz3layer;
            String temp_gz4Layer = CommonLayer.gz4layer;
            CommonLayer.gz1layer = temp_gz3Layer;
            CommonLayer.gz2layer = temp_gz4Layer;
            CommonLayer.gz3layer = temp_gz1Layer;
            CommonLayer.gz4layer = temp_gz2Layer;
            blockCM.Draw(blockSub);
            CommonLayer.gz1layer = temp_gz1Layer;
            CommonLayer.gz2layer = temp_gz2Layer;
            CommonLayer.gz3layer = temp_gz3Layer;
            CommonLayer.gz4layer = temp_gz4Layer;

            blockSub.RemoveDimLayer();
            block.Append(blockSub);

            List<Arc> strcutArc = new List<Arc>();
            List<Point3d> dzPoints = new List<Point3d>();
            blockCM.GetPointsLM_Out(out dzPoints, out strcutArc);
            List<Polyline> structCurve = blockCM.GetStructSideLine();

            //承台基础构造
            Point3d basePnt1 = new Point3d(dzPoints[8].X - block.style.DimFirstLayer, dzPoints[8].Y, 0);
            Point3d basePnt2 = new Point3d(dzPoints[9].X + block.style.DimFirstLayer, dzPoints[9].Y, 0);
            Point3d basePnt3 = new Point3d(basePnt1.X, basePnt1.Y - block.style.DimFirstLayer, 0);
            Point3d basePnt4 = new Point3d(basePnt2.X, basePnt2.Y - block.style.DimFirstLayer, 0);
            //承台基础构造
            Point3d structPnt1 = new Point3d(dzPoints[8].X - block.style.DimSecondLayer, dzPoints[8].Y, 0);
            Point3d structPnt2 = new Point3d(dzPoints[9].X + block.style.DimSecondLayer, dzPoints[9].Y, 0);
            Point3d structPnt3 = new Point3d(structPnt1.X, structPnt1.Y - dwnInsertLong, 0);
            Point3d structPnt4 = new Point3d(structPnt2.X, structPnt2.Y - dwnInsertLong, 0);
            block.AddLine(structPnt1, structPnt2, CommonLayer.gz3layer);
            block.AddLine(structPnt1, structPnt3, CommonLayer.gz3layer);
            block.AddLine(structPnt2, structPnt4, CommonLayer.gz3layer);
            block.AddBreakLine(structPnt3, structPnt4, 0);

            Point3d dimPointV = new Point3d(dzPoints[2].X - 5 * block.style.DimFirstLayer, dzPoints[2].Y, 0);
            block.AddDimRotatedVerti(dimPointV, new Point3d(dimPointV.X, dimPointV.Y - topInforceH, 0), -block.style.DimFirstLayer, 0, null);
            block.AddDimRotatedVerti(new Point3d(dimPointV.X, dimPointV.Y - topInforceH, 0), new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH + dwnInforceH, 0), -block.style.DimFirstLayer, 0, String.Format("H - {0}", topInforceH + dwnInforceH));
            block.AddDimRotatedVerti(new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH + dwnInforceH, 0), new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH, 0), -block.style.DimFirstLayer, 0, null);
            block.AddDimRotatedVerti(new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH, 0), new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH - dwnInsertShort, 0), -block.style.DimFirstLayer, 0, null);
            //总高度标注
            block.AddDimRotatedVerti(dimPointV, new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH, 0), -block.style.DimSecondLayer, 0, "墩柱高度H");
            //标注高度文字
            block.AddText(new Point3d(dimPointV.X, dimPointV.Y - topInforceH * 0.5, 0), "(箍筋加密区)@" + topInforceDist, block.style.RealTextHeigth, Math.PI * 0.5, CommonLayer.dimlayer, TextHorizontalMode.TextMid, TextVerticalMode.TextTop);
            block.AddText(new Point3d(dimPointV.X, dimPointV.Y - topInforceH - (ColumnDrawH - topInforceH - dwnInforceH) * 0.5, 0), "(箍筋标准段)@" + ColumnDist, block.style.RealTextHeigth, Math.PI * 0.5, CommonLayer.dimlayer, TextHorizontalMode.TextMid, TextVerticalMode.TextTop);
            block.AddText(new Point3d(dimPointV.X, dimPointV.Y - ColumnDrawH + dwnInforceH * 0.5, 0), "(箍筋加密区)@" + dwnInforceDist, block.style.RealTextHeigth, Math.PI * 0.5, CommonLayer.dimlayer, TextHorizontalMode.TextMid, TextVerticalMode.TextTop);
            //墩顶水平标注
            block.AddDimContinueHori(new Point3d(dzPoints[2].X, Math.Max(dzPoints[2].Y, dzPoints[3].Y) + block.style.DimSecondLayer, 0), block.style.DimFirstLayer, blockCM_dzY1);
            ///------------------------绘制钢筋-----------------------------
            //侧缘钢筋线
            Polyline steel_SideCurve1 = AcadAssist.ClonePolyline(structCurve[0]);
            steel_SideCurve1.TransformBy(Matrix3d.Displacement(new Vector3d(+BHC, 0, 0)));
            steel_SideCurve1 = AcadAssist.ClonePolyline(steel_SideCurve1);
            steel_SideCurve1 = AcadAssist.ExtendCurveHead(steel_SideCurve1, -BHC);
            steel_SideCurve1 = AcadAssist.ExtendCurveBack(steel_SideCurve1, dwnInsertShort);

            Polyline steel_SideCurve2 = AcadAssist.ClonePolyline(structCurve[1]);
            steel_SideCurve2.TransformBy(Matrix3d.Displacement(new Vector3d(-BHC, 0, 0)));
            steel_SideCurve2 = AcadAssist.ClonePolyline(steel_SideCurve2);
            steel_SideCurve2 = AcadAssist.ExtendCurveHead(steel_SideCurve2, -BHC);
            steel_SideCurve2 = AcadAssist.ExtendCurveBack(steel_SideCurve2, dwnInsertShort);

            //左右外侧曲线钢筋
            SteelPolyLine st_side_curve1 = SteelFactory.CreateSteelCurves(ist_vert_side, steel_SideCurve1);
            SteelPolyLine st_side_curve2 = SteelFactory.CreateSteelCurves(ist_vert_side, steel_SideCurve2);
            //st_curve1.SetExtend(0, donwExtVertShort);
            //st_curve2.SetExtend(0, donwExtVertShort);
            block.AddSteelEntity(st_side_curve1, st_side_curve2);


            //水平钢筋---------
            Point3d StartPoint = new Point3d(dzPoints[0].X, Math.Min(dzPoints[0].Y, dzPoints[1].Y) - BHC, 0);
            Point3d centerPoint1 = new Point3d(dzPoints[0].X, Math.Min(dzPoints[0].Y, dzPoints[1].Y) - BHC, 0);
            Point3d centerPoint2 = new Point3d(centerPoint1.X, centerPoint1.Y - topInforceH, 0);
            Point3d centerPoint3 = new Point3d(centerPoint1.X, dzPoints[8].Y + dwnInforceH, 0);
            Point3d centerPoint4 = new Point3d(centerPoint1.X, dzPoints[8].Y, 0);
            Point3d centerPoint5 = new Point3d(centerPoint1.X, dzPoints[8].Y - dwnInsertHook, 0);

            SteelLines st_hori_line1 = SteelFactory.CreateSteelParalLine(ist_hook_same, centerPoint1, centerPoint2, 0, 0, blockCM_dzY1 + block.style.DimFirstLayer);
            SteelLines st_hori_line2 = SteelFactory.CreateSteelParalLine(ist_hook_same, centerPoint2, centerPoint3, 0, 0, blockCM_dzY1 + block.style.DimFirstLayer);
            SteelLines st_hori_line3 = SteelFactory.CreateSteelParalLine(ist_hook_same, centerPoint3, centerPoint4, 0, 0, blockCM_dzY1 + block.style.DimFirstLayer);
            SteelLines st_hori_line4 = SteelFactory.CreateSteelParalLine(ist_hook_same, centerPoint4, centerPoint5, 0, 0, blockCM_dzY1 + block.style.DimFirstLayer);
            st_hori_line1.SetDrawSteelDetail(SteelLines.LineType.ALL_DIST, topInforceDist, 10);
            st_hori_line2.SetDrawSteelDetail(SteelLines.LineType.ALL_DIST, ColumnDist, 10);
            st_hori_line3.SetDrawSteelDetail(SteelLines.LineType.ALL_DIST, dwnInforceDist, 10);
            st_hori_line4.SetDrawSteelDetail(SteelLines.LineType.ALL_DIST, dwnInsertDist, 10);
            st_hori_line2.isHaveStart = false;
            st_hori_line3.isHaveStart = false;
            st_hori_line4.isHaveStart = false;
            //所有的横线
            List<Line> hori_lines_all = new List<Line>();
            hori_lines_all.AddRange(st_hori_line1.GetLines());
            hori_lines_all.AddRange(st_hori_line2.GetLines());
            hori_lines_all.AddRange(st_hori_line3.GetLines());
            hori_lines_all.AddRange(st_hori_line4.GetLines());
            //横线分为两类 -- 顶部变化段 和 下部直线段
            List<Line> st_hor_curve_right_change = new List<Line>();
            List<Line> st_hor_curve_right_same = new List<Line>();
            double SteelHoriUpsideH = blockCM_dzH1 + blockCM.GetRealChangH_OutSide();
            for (int i = 0; i < hori_lines_all.Count; i++)
            {
                if (hori_lines_all[i].StartPoint.Y > (centerPoint1.Y - SteelHoriUpsideH))
                {
                    st_hor_curve_right_change.Add(hori_lines_all[i]);
                }
                else
                {
                    st_hor_curve_right_same.Add(hori_lines_all[i]);
                }
            }
            SteelCurves st_hori_cv_change = SteelFactory.CreateSteelCurves(ist_hook_change, st_hor_curve_right_change);
            SteelCurves st_hori_cv_same = SteelFactory.CreateSteelCurves(ist_hook_same, st_hor_curve_right_same);
            st_hori_cv_change.ExtendHeadToCurve(steel_SideCurve1);
            st_hori_cv_change.ExtendBackToCurve(steel_SideCurve2);
            st_hori_cv_same.ExtendHeadToCurve(steel_SideCurve1);
            st_hori_cv_same.ExtendBackToCurve(steel_SideCurve2);
            block.AddSteelEntity(st_hori_cv_change, st_hori_cv_same);



            //左侧钢筋-----竖直线钢筋--左侧长短竖直曲线
            Point3d st_vert_hook_pnt1 = new Point3d(dzPoints[0].X, Math.Min(dzPoints[0].Y, dzPoints[1].Y) - BHC, 0);
            Point3d st_vert_hook_pnt2 = new Point3d(st_vert_hook_pnt1.X, dzPoints[8].Y - dwnInsertShort, 0);
            Line st_vert_hook_cenline = new Line(st_vert_hook_pnt1, st_vert_hook_pnt2);
            SteelInterCurves st_vert_temp = SteelFactory.CreateSteelInterCurves(ist_vert_long, steel_SideCurve1, st_vert_hook_cenline);
            st_vert_temp.haveStr = false;
            List<Curve> st_vert_curve = st_vert_temp.GetCurves();
            List<Curve> st_vert_curve_long = new List<Curve>();
            List<Curve> st_vert_curve_short = new List<Curve>();
            for (int i = 0; i < st_vert_curve.Count; i++)
            {
                if (i % 2 == 0)
                    st_vert_curve_short.Add(st_vert_curve[i]);
                else
                    st_vert_curve_long.Add(st_vert_curve[i]);
            }
            //分开成长短两种
            SteelCurves st_vert_short = SteelFactory.CreateSteelCurves(ist_vert_short, st_vert_curve_short);
            SteelCurves st_vert_long = SteelFactory.CreateSteelCurves(ist_vert_long, st_vert_curve_long);
            st_vert_long.ExtendBackToCurve(new Line(structPnt3, structPnt4));
            block.AddSteelEntity(st_vert_short, st_vert_long);


            //左侧钢筋-----墩顶钢筋点
            SteelDotByLine st_top_dot1 = SteelFactory.CreateSteelDots(ist_top_dot, dzPoints[1], dzPoints[3], -BHC - block.style.RealDotRadiu);
            st_top_dot1.SetByCount(8);
            st_top_dot1.SetExtend(-BHC - block.style.RealDotRadiu, -BHC - block.style.RealDotRadiu);

            SteelDotByLine st_top_dot2 = SteelFactory.CreateSteelDots(ist_top_dot2, dzPoints[1], dzPoints[3], -BHC - block.style.RealDotRadiu - 100);
            st_top_dot2.SetExtend(-BHC - block.style.RealDotRadiu, -BHC - block.style.RealDotRadiu);
            st_top_dot2.SetByDist(100);

            SteelDotByLine st_top_dot3 = SteelFactory.CreateSteelDots(ist_top_dot2, dzPoints[1], dzPoints[3], -BHC - block.style.RealDotRadiu - 200);
            st_top_dot3.SetExtend(-BHC - block.style.RealDotRadiu, -BHC - block.style.RealDotRadiu);
            st_top_dot3.SetByDist(100);
            block.AddSteelEntity(st_top_dot1, st_top_dot2, st_top_dot3);

            //--------------------右侧箍筋的钢筋点-----  先计算右侧点所在的竖向和横线线，再求它们的交点 -------------
            //水平线
            List<Curve> st_hori_cv_change_modify = new List<Curve>(st_hori_cv_change.GetCurves());
            if (st_hori_cv_change_modify.Count > 0) st_hori_cv_change_modify.RemoveAt(0);
            if (st_hori_cv_change_modify.Count > 0) st_hori_cv_change_modify.RemoveAt(0);
            if (st_hori_cv_change_modify.Count > 0) st_hori_cv_change_modify.RemoveAt(0);
            //内侧竖直线
            SteelInterCurves st_vert_temp2 = SteelFactory.CreateSteelInterCurves(ist_dot_inner_same, st_vert_hook_cenline, steel_SideCurve2);
            st_vert_temp2.SetType(SteelInterCurves.ArrType.AVERAGE, 2, 100, 2);
            st_vert_temp2.haveStr = false;

            List<Curve> st_vert_inner_curve = st_vert_temp2.GetCurves();
            if (st_vert_inner_curve.Count > 0) st_vert_inner_curve.RemoveAt(st_vert_inner_curve.Count - 1);

            //外侧竖直线
            List<Curve> st_vert_out_curve = new List<Curve>();
            st_vert_out_curve.Add(st_side_curve2.GetSteelbarLine());

            //内侧的箍筋点
            SteelDotsArray st_dot_inner_change = SteelFactory.CreateSteelDots(ist_dot_inner_change, st_vert_inner_curve, st_hori_cv_change_modify);
            st_dot_inner_change.Move(new Vector3d(block.style.RealDotRadiu, block.style.RealDotRadiu, 0));

            SteelDotsArray st_dot_inner_same = SteelFactory.CreateSteelDots(ist_dot_inner_same, st_vert_inner_curve, st_hori_cv_same.GetCurves());
            st_dot_inner_same.Move(new Vector3d(block.style.RealDotRadiu, block.style.RealDotRadiu, 0));

            block.AddSteelEntity(st_dot_inner_change, st_dot_inner_same);//加入数据库

            //外侧的箍筋点
            SteelDotsArray st_dot_side_change = SteelFactory.CreateSteelDots(ist_hook_change, st_vert_out_curve, st_hori_cv_change_modify);
            st_dot_side_change.Move(new Vector3d(block.style.RealDotRadiu, block.style.RealDotRadiu, 0));

            SteelDotsArray st_dot_side_same = SteelFactory.CreateSteelDots(ist_hook_same, st_vert_out_curve, st_hori_cv_same.GetCurves());
            st_dot_side_same.Move(new Vector3d(block.style.RealDotRadiu, block.style.RealDotRadiu, 0));

            block.AddSteelEntity(st_dot_side_change, st_dot_side_same);//加入数据库

            //-----------------------------左侧钢筋的标注---------------------------
            //左侧钢筋标注-----竖直钢筋的标注 -- 外侧边缘钢筋
            Point3d dim_vert_curve_point0 = new Point3d(StartPoint.X - blockCM_dzY1 * 0.5 - block.style.DimFirstLayer, StartPoint.Y - topInforceH - (ColumnNormalH + dwnInforceH) * 0.2, 0);
            SteelbarHLineDimension dim_st_vert_curve0 = SteelDimFactory.CreateHLineDimension(ist_vert_side, st_side_curve1.GetSteelbarLine(), dim_vert_curve_point0, false);

            //左侧钢筋标注-----竖直钢筋的标注 -- 伸入承台短钢筋
            Point3d dim_vert_curve_point1 = new Point3d(StartPoint.X - blockCM_dzY1 * 0.5 - block.style.DimFirstLayer, StartPoint.Y - topInforceH - (ColumnNormalH + dwnInforceH) * 0.4, 0);
            SteelbarHLineDimension dim_st_vert_curve1 = SteelDimFactory.CreateHLineDimension(ist_vert_short, st_vert_curve_short, dim_vert_curve_point1, false);
            //左侧钢筋标注-----竖直钢筋的标注 -- 伸入承台长钢筋
            Point3d dim_vert_curve_point2 = new Point3d(StartPoint.X - blockCM_dzY1 * 0.5 - block.style.DimFirstLayer, StartPoint.Y - topInforceH - (ColumnNormalH + dwnInforceH) * 0.6, 0);
            SteelbarHLineDimension dim_st_vert_curve2 = SteelDimFactory.CreateHLineDimension(ist_vert_long, st_vert_curve_long, dim_vert_curve_point2, false);
            block.AddSteelEntity(dim_st_vert_curve1, dim_st_vert_curve2);

            //左侧钢筋标注-----水平钢筋的标注 -- 变化段箍筋 -------------- [可能用户会要求曲线类型的标注 --- 标注线要曲线]
            Point3d dim_hori_change_point1 = new Point3d(StartPoint.X - blockCM_dzY * 0.25, StartPoint.Y - topInforceH * 0.5, 0);
            Point3d dim_hori_change_point2 = new Point3d(StartPoint.X - blockCM_dzY1 * 0.5 - block.style.DimFirstLayer, dim_hori_change_point1.Y, 0);
            SteelbarConnectDimension dim_st_hori_change = SteelDimFactory.CreateSteelConnectDimensionXY(ist_hook_change, st_hori_cv_change.GetCurves(), dim_hori_change_point1, dim_hori_change_point2, SteelbarConnectDimension.DotType.DOT_COL);
            dim_st_hori_change.IsDimCircleRight = false;
            //左侧钢筋标注-----水平钢筋的标注 -- 不变段箍筋 -------------- [可能用户会要求曲线类型的标注 --- 标注线要曲线]
            Point3d dim_hori_same_point1 = new Point3d(StartPoint.X - blockCM_dzY * 0.25, StartPoint.Y - topInforceH - (ColumnNormalH + dwnInforceH) * 0.8, 0);
            Point3d dim_hori_same_point2 = new Point3d(StartPoint.X - blockCM_dzY1 * 0.5 - block.style.DimFirstLayer, StartPoint.Y - topInforceH - ColumnNormalH * 0.5, 0);
            SteelbarConnectDimension dim_st_hori_same = SteelDimFactory.CreateSteelConnectDimensionXY(ist_hook_same, st_hori_cv_same.GetCurves(), dim_hori_same_point1, dim_hori_same_point2, SteelbarConnectDimension.DotType.DOT_COL);
            dim_st_hori_same.IsDimCircleRight = false;
            block.AddSteelEntity(dim_st_hori_change, dim_st_hori_same);


            //-----------------------------右侧钢筋的标注---------------------------
            bool isDimSideDotAll = false;
            if (isDimSideDotAll)
            {
                //右侧钢筋---外边缘的点钢筋 -- 变化
                Polyline dim_side_dot_curve = AcadAssist.GetOffsetPolylineToRight(steel_SideCurve2, -BHC - 0.5 * block.style.DimFirstLayer);
                SteelbarDotCurveDimension dim_side_dot_change = SteelDimFactory.CreateSteelDotCurveDimension(ist_hook_change, dim_side_dot_curve, st_dot_side_change.GetDotPoints(), SteelbarDotCurveDimension.DotType.ARROW_COL);
                dim_side_dot_change.isAddVertiLine = false;
                dim_side_dot_change.isDimRight = true;
                //右侧钢筋---外边缘的点钢筋 -- 不变
                SteelbarDotCurveDimension dim_side_dot_same = SteelDimFactory.CreateSteelDotCurveDimension(ist_hook_same, dim_side_dot_curve, st_dot_side_same.GetDotPoints(), SteelbarDotCurveDimension.DotType.ARROW_COL);
                dim_side_dot_same.isAddVertiLine = false;
                dim_side_dot_same.isDimRight = true;
                block.AddSteelEntity(dim_side_dot_change, dim_side_dot_same);
            }
            else
            {
                SteelbarDotDimension dim_side_dot_change = SteelDimFactory.CreateSteelDotTDimension(ist_hook_change, AcadAssist.GetLastPoints(st_dot_side_change.GetDotPoints(), 4), SteelbarDotDimension.LineType.ONEDOT_COL, false, false);
                //dim_side_dot_change.SetDimLineLenByValue(BHC + block.style.DimFirstLayer);
                //dim_side_dot_change.isDimRight = true;
                //右侧钢筋---外边缘的点钢筋 -- 不变
                SteelbarDotDimension dim_side_dot_same1 = SteelDimFactory.CreateSteelDotTDimension(ist_hook_same, AcadAssist.GetFirstPoints(st_dot_side_same.GetDotPoints(), 4), SteelbarDotDimension.LineType.ONEDOT_COL, false, false);
                SteelbarDotDimension dim_side_dot_same2 = SteelDimFactory.CreateSteelDotTDimension(ist_hook_same, AcadAssist.GetMidPoints(st_dot_side_same.GetDotPoints(), 4), SteelbarDotDimension.LineType.ONEDOT_COL, false, false);
                //dim_side_dot_curve, st_dot_side_same.GetDotPoints(), SteelbarDotCurveDimension.DotType.ARROW_COL);
                //dim_side_dot_same.isAddVertiLine = false;
                //dim_side_dot_same.isDimRight = true;
                block.AddSteelEntity(dim_side_dot_change, dim_side_dot_same1, dim_side_dot_same2);

            }

            //----------内侧箍筋点 -- [变宽段] ---------
            Polyline dim_inner_polyline_change = new Polyline();
            List<Point3d> inside_points_change = st_dot_inner_change.GetDotPoints();
            inside_points_change.Sort(new CompairPoint3dY());
            int dotColumnChangeCount = inside_points_change.Count / st_vert_inner_curve.Count;
            for (int i = 0; i < dotColumnChangeCount; i++)
            {
                Point3d pt1 = inside_points_change[i * 2 + 0];
                Point3d pt2 = inside_points_change[i * 2 + 1];
                Point3d pt3 = AcadAssist.Mid(pt1, pt2) - Vector3d.YAxis.MultiplyBy(((i == 0) ? -1 : 1) * 2 * block.style.RealDotRadiu);
                block.AddLine(pt1, pt3, CommonLayer.dimlayer);
                block.AddLine(pt2, pt3, CommonLayer.dimlayer);
                dim_inner_polyline_change.AddVertexAt(dim_inner_polyline_change.NumberOfVertices, new Point2d(pt3.X, pt3.Y), 0, 0, 0);
            }
            block.AddCurve(dim_inner_polyline_change, CommonLayer.dimlayer);


            //----------内侧箍筋点 -- [等宽段] ---------
            Polyline dim_inner_polyline_same = new Polyline();
            List<Point3d> inside_points_same = st_dot_inner_same.GetDotPoints();
            inside_points_same.Sort(new CompairPoint3dY());
            int dotColumnSameCount = inside_points_same.Count / st_vert_inner_curve.Count;
            for (int i = 0; i < dotColumnSameCount; i++)
            {
                Point3d pt1 = inside_points_same[i * 2 + 0];
                Point3d pt2 = inside_points_same[i * 2 + 1];
                Point3d pt3 = AcadAssist.Mid(pt1, pt2) - Vector3d.YAxis.MultiplyBy(((i == 0) ? -1 : 1) * 2 * block.style.RealDotRadiu);
                block.AddLine(pt1, pt3, CommonLayer.dimlayer);
                block.AddLine(pt2, pt3, CommonLayer.dimlayer);
                dim_inner_polyline_same.AddVertexAt(dim_inner_polyline_same.NumberOfVertices, new Point2d(pt3.X, pt3.Y), 0, 0, 0);
            }
            block.AddCurve(dim_inner_polyline_same, CommonLayer.dimlayer);


            //右侧钢筋----顶层点钢筋
            Point3d dim_top_dot_points = new Point3d(dzPoints[3].X + block.style.DimFirstLayer, dzPoints[3].Y + 0.5 * block.style.DimFirstLayer, 0);
            SteelbarDotPalXYDimension dim_top_dot = SteelDimFactory.CreateSteelParallDimension(st_top_dot1, SteelbarDotPalXYDimension.LineType.PALX_ENDTEXT, dim_top_dot_points, true);// false);
            //右侧钢筋---顶层线钢筋
            Line dim_st_top_steel_line = new Line(dzPoints[1] - Vector3d.YAxis.MultiplyBy(BHC), dzPoints[3] - Vector3d.YAxis.MultiplyBy(BHC));
            Point3d dim_top_lin_points = new Point3d((dzPoints[1].X + dzPoints[3].X) * 0.5, dzPoints[3].Y + block.style.DimFirstLayer, 0);
            SteelbarVLineDimension dim_top_lin = SteelDimFactory.CreateVLineDimension(ist_top_lin, new Line(dzPoints[1], dzPoints[3]), dim_top_lin_points, false);
            block.AddSteelEntity(dim_top_dot, dim_top_lin);
            //右侧钢筋---第二层第三层点钢筋
            Point3d dim_top_dot_points2 = new Point3d(dzPoints[3].X + 0.5 * block.style.DimFirstLayer, dzPoints[3].Y - block.style.DimFirstLayer, 0);
            SteelbarDotDimension dim_top_dot2 = SteelDimFactory.CreateSteelDotTDimension(st_top_dot1, new List<Point3d>(), SteelbarDotDimension.LineType.ONEDOT_COL, true, false);
            dim_top_dot2.ArrowPoints.AddRange(AcadAssist.GetLastPoints(st_top_dot2.GetDotPoints(), 2));
            dim_top_dot2.ArrowPoints.AddRange(AcadAssist.GetLastPoints(st_top_dot3.GetDotPoints(), 2));
            dim_top_dot2.SetDimOneDotPointByValue(dim_top_dot_points2);
            //右侧钢筋---第二层第三层线钢筋
            Point3d dim_top_lin_points2 = new Point3d((dzPoints[1].X + dzPoints[3].X) * 0.5, dzPoints[3].Y - topInforceDist * 2.3 - block.style.DimSecondLayer, 0);
            List<Line> dim_top_line2 = new List<Line>();
            dim_top_line2.Add(new Line(dzPoints[1] - Vector3d.YAxis.MultiplyBy(BHC + topInforceDist), dzPoints[3] - Vector3d.YAxis.MultiplyBy(BHC + topInforceDist)));
            dim_top_line2.Add(new Line(dzPoints[1] - Vector3d.YAxis.MultiplyBy(BHC + 2 * topInforceDist), dzPoints[3] - Vector3d.YAxis.MultiplyBy(BHC + 2 * topInforceDist)));
            SteelbarVLineDimension dim_top_lin2 = SteelDimFactory.CreateVLineDimension(ist_top_lin2, dim_top_line2, dim_top_lin_points2, true);
            dim_top_lin2.SteelDimLeaderLen = (blockCM_dzY1 * 0.25 + block.style.DimSecondLayer) / block.style.BlockScale;
            block.AddSteelEntity(dim_top_dot2, dim_top_lin2);


            ///图块名
            if (CommonSimbel.IsDownTitle)
            {
                block.AddTitle(new Point3d(StartPoint.X, StartPoint.Y - blockCM_dzH - dwnInsertLong - 3 * block.style.DimFirstLayer, 0), "侧  面");
            }
            else
            {
                block.AddTitle(new Point3d(StartPoint.X, Math.Max(dzPoints[0].Y, dzPoints[1].Y) + 4 * block.style.DimFirstLayer, 0), "侧  面");
            }
        }



    }
}
